﻿function changeTabPage(thisCtlId, itemId, labelId) {
    // data
    var currentSelected = $("#" + thisCtlId + ">.tab_item_panel>.tabpanel.selected");

    var newId = thisCtlId + "_" + itemId;
    if (currentSelected[0].id == newId) {
        return;
    }
    currentSelected.slideUp();
    currentSelected.removeClass("selected");
    var newSelected = $("#" + newId);
    newSelected.slideDown();
    newSelected.addClass("selected");

    // label
    var currentLabel = $("#" + thisCtlId + ">.tab_label_panel>.tablabel.selected");
    currentLabel.removeClass("selected");
    var newLabel = $("#" + thisCtlId + "_" + labelId);
    newLabel.addClass("selected");

    // selection tracker
    $("#" + thisCtlId + "_TabControl_SelectedIndex")[0].value = itemId.substr(1, itemId.length);
}